package se.no.noko.engine.utils;

import java.util.Collection;
import java.util.Iterator;

import se.no.noko.engine.primitives.ColoredVertex;

public class VertexUtils {

	public static void fillArrayWithColoredVertices(float[] array,
			Collection<ColoredVertex> vertices) {
		int i = 0;
		for (Iterator<ColoredVertex> iterator = vertices.iterator(); iterator
				.hasNext();) {
			ColoredVertex coloredVertex = iterator.next();
			array[i] = coloredVertex.getPosition().x;
			array[i + 1] = coloredVertex.getPosition().y;
			array[i + 2] = coloredVertex.getPosition().z;
			array[i + 3] = coloredVertex.getColor().r;
			array[i + 4] = coloredVertex.getColor().g;
			array[i + 5] = coloredVertex.getColor().b;
			array[i + 6] = coloredVertex.getColor().a;
			i += 7;
		}
	}
}
